package day6;

import java.util.Arrays;

public class Player {
    private String name;
    private Card[] cards;

    public Player(String name){
        this.name = name;
        cards = new Card[0];
    }

    @Override
    public String toString() {
        return "Player{" +
                "name='" + name + '\'' +
                ", cards=" + Arrays.toString(cards) +
                '}';
    }

    //构造器
    //拿牌
    public void addCard(Card card){
        //扩容
        this.cards = Arrays.copyOf(cards, cards.length + 1);
        this.cards[this.cards.length - 1] = card;
    }

    public String getName(){
        return name;
    }

    public Card[] getCards(){
        return cards;
    }
}
